<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/admin.css" />
	<script type='text/javascript' src='__PUBLIC__/js/jquery.min.js'></script>
	<script type='text/javascript' src='__PUBLIC__/layer/layer.js'></script>
	<script type='text/javascript' src='__PUBLIC__/admin/js/common.js'></script>
    <title>后台管理</title>
</head>
<body>
<div class="main-container clearfix"><div class="main-content"><div class="inner"><div class="mall-manage">
    <div class="comm-list" style="min-height:600px">
        <div class="comm-top">
            <div class="title-left">
                数据列表
            </div>
            <div class="title-right" style="top:8px;">
            <form method="get" action="<{:U('index')}>">
                <input type="hidden" name="m" value="<{:MODULE_NAME}>" />
                <input type="hidden" name="c" value="<{:CONTROLLER_NAME}>" />
                <input type="hidden" name="a" value="<{:ACTION_NAME}>" />
                <input type="hidden" name="type" value="<{:I('get.type')}>" />
                <input name="keywords" class="textarea search_inp" placeholder="请输入关键词" type="text" value="<{:I('get.keywords')}>"/>
                <input value="搜索" class="btn btn-success search_btn" type="submit" />
                <input value="添加<{:I('get.type')==1?'医生':'营养师'}>" class="btn btn-success search_btn" type="button" onclick="location.href='<{:U('edit',array('type'=>I('get.type')))}>'" />
            </form>
            </div>
        </div>
        <div class="list-table">
            <div class="wrapper">
                <table class="stable">
                    <thead>
                        <tr>
                            <th style="width:150px;">头像</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>手机</th>
                            <th>年龄</th>
                            <if condition="$_GET['type'] eq '1'">
                                <th>所在医院</th>
                                <th>患者数/达标数</th>
                            </if>
                            <th>积分</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <foreach name="list" item="v">
                            <tr>
                                <td><if condition="$v['pic'] neq ''"><img src="<{$v.pic}>" /></if></td>
                                <td><{$v.name}></td>
                                <td><{:$v['sex']==2?'女':'男'}></td>
                                <td><{$v.phone}></td>
                                <td><{$v.age}></td>
                                <if condition="$_GET['type'] eq '1'">
                                    <td><{$cityRow[$v['city_id']]}><{$v.hpt_name}></td>
                                    <td><{$v.patientNum}> / <{$v.sefeWeightNum}></td>
                                </if>
                                <td><{$v.score|default='0'}></td>
                                <td><div class="btn-operate">
                                    <a href="<{:U('patient_list',array('id'=>$v['id'],'dname'=>$v['name'],'type'=>I('get.type')))}>"><span class="btngreen30">名下患者</span></a>
                                    <span class="btngreen30" onclick="addScore('<{$v.id}>','<{$v.name}>')">添加积分</span>
                                    <a href="<{:U('edit',array('id'=>$v['id'],'type'=>I('get.type')))}>" title="修改"><i class="glyphicon glyphicon-edit"></i></a>
                                    <a href="javascript:void(0);" onclick="delRow('<{$v.id}>',this)" title="删除" id="delBtn<{$v.id}>"><i class="glyphicon glyphicon-trash"></i></a>
                                </div></td>
                            </tr>
                        </foreach>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="page-list"><{$page}></div>
    </div>
</div></div></div></div>

<!-- 弹框 begin-->
<style>
.ddgl_fix_5072{width:100%;height:auto;overflow:hidden;position:relativ;top:0;left:0;z-index:99;display:none;}
.ddgl_fix_5072_bg{width:100%;height:100%;z-index:999;position:absolute;left:0;top:0;}
.ddgl_fix_5072_con{width:300px;height:auto;overflow:hidden;border:5px solid #e7e7e7;border-radius:5px;background:#fff;position:fixed;z-index:9999;left:50%;top:40%;margin:-100px 0 0 -150px;}
.ddgl_fix_5072_tit{height:30px;line-height:30px;font-size:16px;color:#009997;text-align:center;border-bottom:1px solid #ddd;}
.ddgl_fix_5072_tit span{float:right;display:block;width:20px;height:20px;background:#ccc;border-radius:50%;line-height:20px;text-align:center;cursor:pointer;}
.ddgl_fix_5072_slct{width:100%;padding:10px 0;font-size:14px;color:#666;text-align:center;}
.ddgl_fix_5072_slct input{width:70%;border:1px solid #e7e7e7;padding:3px;font-size:14px;}
.ddgl_fix_5072_sub {width:100%;height:30px;line-height:30px;font-size:16px;color:#fff;margin-bottom:15px;}
.ddgl_fix_5072_sub input[type=button]{width:39%;height:30px;line-height:30px;text-align:center;font-size:16px;color:#fff;background:#ccc;margin:0 5%;border:none;border-radius:4px;cursor:pointer;} 
.ddgl_fix_5072_sub input[type=button]:first-child{background:#009997;} 
</style>
<div class="ddgl_fix_5072" id="sender">
<div class="ddgl_fix_5072_bg"></div>
<div class="ddgl_fix_5072_con">
	<div class="ddgl_fix_5072_tit">增加积分</div>
	<form id="typeForm">
		<input type="hidden" id="popInp0" />
		<div class="ddgl_fix_5072_slct">增加值： 
			<input type="text" id="popInp1" />
			<!-- <br><sort class="c-red">注：序号越小越靠前</sort> -->
		</div>
		<div class="ddgl_fix_5072_slct">事&nbsp;&nbsp;&nbsp;由： 
			<input type="text" id="popInp2" maxlength="20" />
		</div>
		<div class="ddgl_fix_5072_sub">
			<input type="button" value="确定" id="sureBtn" onclick="save(this)">
			<input type="button" value="取消" onclick="$('#sender').hide()">
		</div>
	</form>
	</div>
</div>
<!-- 弹框 end-->

<script type="text/javascript">
function delRow(id,obj){
    if(confirm('确定要删除吗？')){
        $.post("<{:U('del')}>",{id:id},function(res){
            res=$.trim(res);
            if(res=='suc'){
                note_info('删除成功',obj);
                setTimeout('location.reload()',1200);
            }else{
                note_info('删除失败',obj,'warn');
            }
        });
    }
}
//增加积分
function addScore(id,name){
    $('#sender').show();
    $('.ddgl_fix_5072_tit').text(name+'-增加积分');
    $('#popInp0').val(id);
}
function save(obj){
    if(!isNumber($('#popInp1').val())){
        note_info('请输入积分数值',obj,'warn');return;
    }
    if($('#popInp2').val()==''){
        note_info('请填写增加积分事由',obj,'warn');return;
    }
    $.post('<{:U("addScore")}>',{id:$('#popInp0').val(),score:$('#popInp1').val(),reason:$('#popInp2').val()},function(){
        location.reload();
    });
}
//验证为正整数
function isNumber(s){
	var patrn=/^[1-9][0-9]*$/;  
	if (!patrn.exec(s)) return false
	return true
}
</script>
</body>
</html>